class Evaluator:
    def __init__(self, data):
        self.data = data

    def evaluate_performance(self):
        # 在这里实现绩效评估逻辑，例如计算年化收益率、总收益率等
        total_return = self.calculate_total_return()
        annualized_return = self.calculate_annualized_return()
        return total_return, annualized_return

    def calculate_total_return(self):
        # 计算总收益率
        cumulative_returns = (1 + self.data['strategy_returns']).cumprod()
        total_return = cumulative_returns.iloc[-1] - 1
        return total_return

    def calculate_annualized_return(self):
        # 计算年化收益率
        total_return = self.calculate_total_return()
        years = len(self.data) / 252  # 假设每年有252个交易日
        annualized_return = (1 + total_return) ** (1 / years) - 1
        return annualized_return
        
